home *** CD-ROM | disk | FTP | other *** search
/ .net 2002 March / DotNetMagazine-Issue107-Coverdisc-NET107-02-03-PCMac.bin / pc / PC Software / free_browsing / DavesQckSearchDbar3-14 / dqsd.exe / searches / yp.xml < prev    next >
Text File  |  2002-09-27  |  4KB  |  127 lines

  1. <search function="yp">
  2.   <name>Yahoo! Yellow Pages</name>
  3.   <description>Search Yahoo Yellow Pages
  4.   <div class="helpboxDescLabels">Examples:</div> 
  5.   <table class="helpboxDescTable">
  6.     <tr>
  7.       <td>yp business" (uses personalization variables or last location)</td>
  8.     </tr>
  9.     <tr>
  10.       <td>yp cubby, 1060 W. Addison Street, Chicago, IL</td>
  11.     </tr>
  12.     <tr>
  13.       <td>yp cubby, 1060 W. Addison Street, Chicago IL</td>
  14.     </tr>
  15.     <tr>
  16.       <td>yp cubby, Chicago, IL</td>
  17.     </tr>
  18.     <tr>
  19.       <td>yp cubby, Chicago IL</td>
  20.     </tr>
  21.     <tr>
  22.       <td>yp cubby, 60613</td>
  23.     </tr>
  24.   </table>
  25.   </description>
  26.   <category>People and Places</category>
  27.   <link>http://yp.yahoo.com/</link>
  28.   <form name="ypf" method="get" action="http://yp.yahoo.com/py/yploc.py">
  29.     <input type="hidden" name="stp" value="a"/>
  30.     <input type="hidden" name="clr" value="ypResults"/>
  31.     <input type="hidden" name="stx" value=""/>
  32.     <input type="hidden" name="addr_in" value=""/>
  33.     <input type="hidden" name="csz_in" value=""/>
  34.     <input type="hidden" name="country_in" value="us"/>
  35.     <input type="hidden" name="newFL" value="NONE"/>
  36.     <input type="hidden" name="submit_field" value="1"/>
  37.     </form>
  38.   <script><![CDATA[
  39.  
  40. // TODO: Support Canada. Biggest annoyance is the user interface.
  41. //  Best option seems like it would be to recognize Canadian
  42. //  province names/abbreviations & post codes, and use that to
  43. //  specify Canada, with the ability to override with a switch.
  44.  
  45. // TODO: Support searches like "yp cubby, 1060 W. Addison St, 60613"
  46. //  Probably distinguished by 3 argument case where last field is a zip
  47. //  code (not a state) and second field has digits in it (to distinguish
  48. //  from "yp cubby, Chicago IL, 60613".
  49.  
  50.         function yp(q) {
  51.             document.ypf.submit_field.name = "submit";
  52.             
  53.             if (nullArgs("yp", q)) {
  54.                 return false;
  55.             }
  56.             
  57.             if (q == "") {
  58.                 openSearchWindow("http://yp.yahoo.com");
  59.             } else {
  60.                 var param = q.split(",");
  61.  
  62.                 document.ypf.stx.value = param[0];
  63.  
  64.                 // One parameter: fill in address from variables,
  65.                 // unless we don't have variables, in which case
  66.                 // don't change the address from last time used. 
  67.                 if (param.length == 1) {
  68.                     var csz = "";
  69.                     if (typeof user_city != "undefined" && user_city != "" &&
  70.                         typeof user_state != "undefined" && user_state != "") {
  71.                         csz = user_city + " " + user_state;
  72.                     }
  73.                     if (typeof user_zip != "undefined" && user_zip != "") {
  74.                         if (csz != "") {
  75.                             csz = csz + " ";
  76.                         }
  77.                         csz = csz + user_zip;
  78.                     }
  79.                     if (csz != "") {
  80.                         document.ypf.csz_in.value = csz;
  81.                     }
  82.                     if (typeof user_address != "undefined" && user_address != "") {
  83.                         document.ypf.addr_in.value = user_address;
  84.                     } else if (csz != "") { // So we don't use an old address with constant city & state
  85.                         document.ypf.addr_in.value = "";
  86.                     }
  87.                 } else if (param.length == 2) {
  88.                 // Two parameters: Second must be city/state/zip
  89.                     document.ypf.addr_in.value = "";
  90.                     document.ypf.csz_in.value = param[1];
  91.                 } else if (param.length == 3) {
  92.                 // Three parameters: Tricky case; could be City, State or Addr, City State
  93.                     if (param[2].search(/^\s*\w+\s*$/) != -1) { // It's one word: a state
  94.                         document.ypf.addr_in.value = "";
  95.                         document.ypf.csz_in.value = param[1] + " " + param[2];
  96.                     } else {
  97.                         document.ypf.addr_in.value = param[1];
  98.                         document.ypf.csz_in.value = param[2];
  99.                     }
  100.                 } else if (param.length == 4) {
  101.                 // Four parameters: Must be Addr, City, State
  102.                     document.ypf.addr_in.value = param[1];
  103.                     document.ypf.csz_in.value = param[2] + " " + param[3];
  104.                 } else {
  105.                 // More than four: what to do??
  106.                 // Use last two or three for addr, city, state; concatentate the rest with commas for the query.
  107.                     var csz;
  108.                     csz = param.pop();
  109.                     if (csz.search(/^\s*\w+\s*$/) != -1) { // It's one word: a state
  110.                         csz = param.pop() + " " + csz;
  111.                     }
  112.                     document.ypf.csz_in.value = csz;
  113.                     document.ypf.addr_in.value = param.pop();
  114.                     document.ypf.stx.value = param.join(",");
  115.                 }
  116.                 submitForm(ypf);
  117.             }
  118.         }    
  119.     ]]></script>
  120.  
  121.   <copyright>
  122.     Copyright (c) 2002 David Bau
  123.     Distributed under the terms of the
  124.     GNU Public License, Version 2 (http://www.gnu.org/copyleft/gpl.txt)
  125.   </copyright>
  126. </search>
  127.